<?php
define('MY_ROOT', dirname(__FILE__));
if(php_sapi_name()!='cli')
    die('cli only');
require MY_ROOT . '/source/core.php';
$core = core::instance();
$r = DB::select('member','`id`=1');
if(!$r)
{
    echo "Installing root user, type your new password\n";
    $pass = fgets(STDIN);
    $pass = trim($pass);
    $pwd = password_hash($pass, PASSWORD_DEFAULT);
    DB::insert('member',['username'=>'root','password'=>$pwd,'email'=>'root@localhost','groups'=>'1','description'=>'Root Install User']);
    DB::insert('groups',['name'=>'root','authz'=>serialize(['global'=>1])]);
}



